package com.example.alarmclock;

import android.app.AlarmManager;
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;

public class AlarmReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        Log.d("AlarmReceiver","收到广播");
        Intent intent1 = new Intent(context,AlarmMessage.class);
        intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(intent1);
//        new AlertDialog.Builder(context)
//                .setIcon(R.drawable.ic_launcher_background)
//                .setTitle("闹钟")
//                .setMessage("时间到")
//                .setPositiveButton("关闭", null)
//                .setNegativeButton("Cancel",null)
//                .show();
//        Toast.makeText(context,"时间到",Toast.LENGTH_SHORT).show();
    }
}
